<template>
  <div class="housing">
      <header class="header">
          <img @click="back" src="http://bpic.588ku.com/original_pic/19/04/18/9ac65d10f0e5ede674d0ab0abcad5b96.jpg" alt="">
          <h3>楼市圈</h3>
      </header>
      <div class="content">
          <div class="list" v-for="(item,index) in housingList" :key='index'>
              <div class="top">
                <dl class="title">
                    <dt>
                        <img :src="item.info.broker.base.photo" alt="">
                    </dt>
                    <dd>
                        <span>{{item.info.broker.base.name}}</span>
                        <span></span>
                    </dd>
                </dl>
                <div class="phone">
                    <span @click="consult">在线咨询</span>
                    <span @click="phone">拨打电话</span>
                </div>
                
            </div>
            <div class="data">
                <span>{{item.info.community.base.completionTime}}</span>
                <dl class="solo">
                    <dd>
                        <span>{{item.info.community.base.name}}</span>
                    </dd>
                    <dt>
                        <img :src="item.info.community.base.defaultPhoto" alt="">
                    </dt>
                </dl>
            </div>
          </div>
          
      </div>
  </div>
</template>

<script>
import {housingList} from '../../services/index'
export default {
    data() {
        return {
            housingList:[]
        }
    },
    async onShow(){
        let result=await housingList()
        console.log(result,'redd');
        if(result.status==0){
            this.housingList=result.data.list
        }
        console.log(this.housingList,'this.housingList');
        
    },
    methods: {
         back(){
            wx.switchTab({    //跳转到tabBar页面，并关闭其他所有tabBar页面
                url:"/pages/index/index"
            })
              console.log(111);
        },
        consult(){
            wx.navigateTo({    //保留当前页面，跳转到应用内的某个页面（最多打开5个页面，之后按钮就没有响应的）
                url:"/pages/housingMsg/index"
            })
            console.log('sfjskd');
        },
        phone(){
            // wx.navigateTo({    //保留当前页面，跳转到应用内的某个页面（最多打开5个页面，之后按钮就没有响应的）
            //     url:"/pages/phone/index"
            // })
             wx.makePhoneCall({
                phoneNumber: '1340000' //仅为示例，并非真实的电话号码
            })
        }
    },
}
</script>

<style lang="scss" scoped>
    .housing{
        width: 100%;
        height: 100%;
        background-color: rgb(35,145,249);
        display: flex;
        flex-direction: column;
        
    }
    .header{
        width: 100%;
        height: 80rpx;
        line-height: 60rpx;
        margin-top: 50rpx;
        margin-bottom: 10px;
        display: flex;
        padding: 0 20px;
        box-sizing: border-box;
        align-items: center;
        color:#fff ;
        h3{
            margin: 0px 100px;
        }
        img{
            width: 20px;
            height: 20px;
            padding: 0px 5px;
        }
    }
    .content{
        width: 100%;
        background-color: #fff;
        display: flex;
        flex-direction: column;
        .list{
            width: 100%;
            display: flex;
            flex-direction: column;
            .top{
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-top: 10px;
                .title{
                    display: flex;
                    align-items: center;
                    padding: 0 10px;
                    img{
                        width: 40px;
                        height: 40px;
                        border-radius: 50%;
                    }
                    span{
                        margin: 0 5px;
                    }
                }
                .phone{
                    padding: 0 10px;
                    display: flex;
                    justify-content: space-around;
                    align-items: center;
                    span{
                        margin: 0px 5px;
                        width: 80px;
                        background-color: #fff;
                        color: rgb(218, 117, 120);
                        text-align: center;
                        border: 2px solid rgb(220,148,151);
                        height: 30px;
                        line-height: 30px;
                        border-radius: 5px;
                    }
                }
            }
            .data{
                display: flex;
                width: 100%;
                span{
                    padding: 30px  10px;
                }
                .solo{
                    padding: 30px  10px;
                    border-bottom: 1px solid #ccc;
                    img{
                        margin-top: 15px;
                        width: 230px;
                        height: 200px;
                    }
                }
            }
        }
    }
</style>